#include <stdio.h>
#include <math.h>
int main()
{
	float a,b,c=35000,c0;
	float fa,fb,fc;
	float e=0.00001;
	a=-3;
	b=7;
	do
	{	
		if (c!=35000)
			c0=c;
		else
			c0=0;
		fa=(a-1)*(a-1)-exp(a)/2;
		fb=(b-1)*(b-1)-exp(b)/2;
		
		c=a-(b-a)/(fb-fa)*fa;
		
		fc=(c-1)*(c-1)-exp(c)/2;
		printf("temp %f %f %f\n",fa,fc,fb);
		printf("%f %f %f\n",a,c,b);
		if (fa*fc<0)
				b=c;
		else
				a=c;
		
	}	while (fabs(c-c0)>e);
	printf("C=%f",c);
	return 0;

}